package com.example.canalclientsync.canal.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

//import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 注解：TableId、TableFiled - Mybatis-plus 字段映射<br></br>
 * 注解：Column - Canal字段映射 <br></br>
 * 注解：Field - Elasticsearch字段映射
 * </p>
 *
 * @author chen.cr
 * @since 2023/9/14
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_dir")
public class Dir extends Documentable implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    @Field(type = FieldType.Long)
    private Long id;

    @TableField("parent_id")
    //@Column(name = "parent_id")
    @Field(type = FieldType.Long)
    private Long parentId;

    @TableField("name")
    //@Column(name = "name")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String name;

    @TableField("sort")
    //@Column(name = "sort")
    private Integer sort;

    @TableField("type")
    //@Column(name = "type")
    private Integer type;

    @TableField("type_relate_id")
    //@Column(name = "type_relate_id")
    private String typeRelateId;

    @TableField("tree_id")
    //@Column(name = "tree_id")
    private String treeId;

    @TableField("tree_name")
    //@Column(name = "tree_name")
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String treeName;

    @TableField("tree_type")
    //@Column(name = "tree_type")
    private String treeType;

    @TableField("origin_id")
    //@Column(name = "origin_id")
    private Long originId;

    @TableField("origin_type")
    //@Column(name = "origin_type")
    private Integer originType;

    @TableField("create_time")
    //@Column(name = "create_time")
    @Field(type = FieldType.Date)
//    @Field(type = FieldType.Date, format = {}, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField("create_user_id")
    //@Column(name = "create_user_id")
    private Integer createUserId;

    @TableField("update_time")
    //@Column(name = "update_time")
    @Field(type = FieldType.Date)
//    @Field(type = FieldType.Date, format = {}, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField("update_user_id")
    //@Column(name = "update_user_id")
    private Integer updateUserId;

    @TableField("tenant_id")
    //@Column(name = "tenant_id")
    private String tenantId;

}
